ReadFromFile Method (Attachment Object)
The ReadFromFile
method loads the contents of an attachment from a file.
Syntax
objAttachment.ReadFromFile(fileName)
Parameters
objAttachment
Required. The
Attachment object.
fileName
Required. The
full path and file name to read. For example, C:\DOCUMENT\BUDGET.XLS.
Remarks
The ReadFromFile
method replaces the existing contents of the Attachment object, if any.
The ReadFromFile
method operates differently, depending on the value of the Attachment object s Type
Attachment
Type property |
ReadFromFile
operation |
mapiFileData
|
Copies the
contents of the specified file to the attachment. |
mapiFileLink
|
Not
supported; generates the run-time error MAPI_E_NO_SUPPORT. |
mapiOLE |
The specified
file must be a valid OLE docfile, such as a file previously written by the WriteToFile |
mapiEmbeddedMessage
|
Copies the
embedded message to the attachment. |
The term OLE
docfile indicates that the file is written by an application such as Microsoft
Word 6.0 or later that writes files using the OLE IStorage and IStream
interfaces.
Note OLE Messaging
Library version 1.0 does not support ReadFromFile for mapiFileLink
attachments. This call generates the run-time error MAPI_E_NO_SUPPORT.
See Also
Add Method (Attachments Collection)